import { ImageResponse } from 'next/og'; import { api, safe } from '@/lib/api'; import { fmtInt } from '@/lib/format'; export const alt = 'Constellation summary — SatelliteIndex'; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; const ORBIT_HEX: Record = { LEO: '#38d3ff', MEO: '#8f7dff', GEO: '#f5b544', HEO: '#ff7ab6' }; export default async function Image({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const res = await safe(api.constellation(slug)); const d = res?.data ?? null; const orbit = d?.orbit_class ?? 'MIXED'; const color = ORBIT_HEX[orbit] ?? '#7c869e'; return new ImageResponse( (
SatelliteIndex · Constellation
{orbit}
{d ? (
28 ? 60 : 84, fontWeight: 700, letterSpacing: -2, lineHeight: 1 }}>{d.name}
{`${d.operator_name ?? 'Operator unavailable'}${d.country_name ? ` · ${d.country_name}` : ''}`}
) : (
Constellation
)}
{[ { label: 'Active satellites', value: d ? fmtInt(d.active) : '—', c: '#38d17f' }, { label: 'Total launched', value: d ? fmtInt(d.total) : '—', c: '#eaf0ff' }, { label: 'Launched 365 d', value: d ? fmtInt(d.launched_last_365d) : '—', c: '#eaf0ff' }, { label: 'Launches', value: d ? fmtInt(d.launches) : '—', c: '#eaf0ff' }, ].map((k) => (
{k.label}
{k.value}
))}
), size, ); }